HW 1

1. Given the formulated question from the assignment description, you will now conduct EDA Checklist items 2-4. First, download 2002 and 2022 data for all sites in California from the EPA Air Quality Data website. Read in the data using data.table(). For each of the two datasets, check the dimensions, headers, footers, variable names and variable types. Check for any data issues, particularly in the key variable we are analyzing. Make sure you write up a summary of all of your findings.

Each data collection includes 20 different types of information, such as identifiers and names for locations, latitude and longitude coordinates, county details, larger CBSA identifiers and names, and state identifiers and names. Additionally, each dataset provides data for a daily count of observations , the average daily concentration of PM2.5 particles, the daily Air Quality Index (AQI), and the date for each day throughout the year. Notably, in 2002, there were 15,976 recorded observations, and in 2022, a much larger dataset with 57,775 observations was collected.

setwd("/users/debbieargueta")
PM2002 <- read.csv("2002_data.csv")
PM2022 <- read.csv("2022_data.csv")

str(PM2002)
'data.frame':   15976 obs. of  20 variables:
 $ Date                          : chr  "01/05/2002" "01/06/2002" "01/08/2002" "01/11/2002" ...
 $ Source                        : chr  "AQS" "AQS" "AQS" "AQS" ...
 $ Site.ID                       : int  60010007 60010007 60010007 60010007 60010007 60010007 60010007 60010007 60010007 60010007 ...
 $ POC                           : int  1 1 1 1 1 1 1 1 1 1 ...
 $ Daily.Mean.PM2.5.Concentration: num  25.1 31.6 21.4 25.9 34.5 41 29.3 15 18.8 37.9 ...
 $ UNITS                         : chr  "ug/m3 LC" "ug/m3 LC" "ug/m3 LC" "ug/m3 LC" ...
 $ DAILY_AQI_VALUE               : int  78 92 71 80 98 115 87 57 65 107 ...
 $ Site.Name                     : chr  "Livermore" "Livermore" "Livermore" "Livermore" ...
 $ DAILY_OBS_COUNT               : int  1 1 1 1 1 1 1 1 1 1 ...
 $ PERCENT_COMPLETE              : num  100 100 100 100 100 100 100 100 100 100 ...
 $ AQS_PARAMETER_CODE            : int  88101 88101 88101 88101 88101 88101 88101 88101 88101 88101 ...
 $ AQS_PARAMETER_DESC            : chr  "PM2.5 - Local Conditions" "PM2.5 - Local Conditions" "PM2.5 - Local Conditions" "PM2.5 - Local Conditions" ...
 $ CBSA_CODE                     : int  41860 41860 41860 41860 41860 41860 41860 41860 41860 41860 ...
 $ CBSA_NAME                     : chr  "San Francisco-Oakland-Hayward, CA" "San Francisco-Oakland-Hayward, CA" "San Francisco-Oakland-Hayward, CA" "San Francisco-Oakland-Hayward, CA" ...
 $ STATE_CODE                    : int  6 6 6 6 6 6 6 6 6 6 ...
 $ STATE                         : chr  "California" "California" "California" "California" ...
 $ COUNTY_CODE                   : int  1 1 1 1 1 1 1 1 1 1 ...
 $ COUNTY                        : chr  "Alameda" "Alameda" "Alameda" "Alameda" ...
 $ SITE_LATITUDE                 : num  37.7 37.7 37.7 37.7 37.7 ...
 $ SITE_LONGITUDE                : num  -122 -122 -122 -122 -122 ...
str(PM2022)
'data.frame':   57775 obs. of  20 variables:
 $ Date                          : chr  "01/01/2022" "01/02/2022" "01/03/2022" "01/04/2022" ...
 $ Source                        : chr  "AQS" "AQS" "AQS" "AQS" ...
 $ Site.ID                       : int  60010007 60010007 60010007 60010007 60010007 60010007 60010007 60010007 60010007 60010007 ...
 $ POC                           : int  3 3 3 3 3 3 3 3 3 3 ...
 $ Daily.Mean.PM2.5.Concentration: num  12.7 13.9 7.1 3.7 4.2 3.8 2.3 6.9 13.6 11.2 ...
 $ UNITS                         : chr  "ug/m3 LC" "ug/m3 LC" "ug/m3 LC" "ug/m3 LC" ...
 $ DAILY_AQI_VALUE               : int  52 55 30 15 18 16 10 29 54 47 ...
 $ Site.Name                     : chr  "Livermore" "Livermore" "Livermore" "Livermore" ...
 $ DAILY_OBS_COUNT               : int  1 1 1 1 1 1 1 1 1 1 ...
 $ PERCENT_COMPLETE              : num  100 100 100 100 100 100 100 100 100 100 ...
 $ AQS_PARAMETER_CODE            : int  88101 88101 88101 88101 88101 88101 88101 88101 88101 88101 ...
 $ AQS_PARAMETER_DESC            : chr  "PM2.5 - Local Conditions" "PM2.5 - Local Conditions" "PM2.5 - Local Conditions" "PM2.5 - Local Conditions" ...
 $ CBSA_CODE                     : int  41860 41860 41860 41860 41860 41860 41860 41860 41860 41860 ...
 $ CBSA_NAME                     : chr  "San Francisco-Oakland-Hayward, CA" "San Francisco-Oakland-Hayward, CA" "San Francisco-Oakland-Hayward, CA" "San Francisco-Oakland-Hayward, CA" ...
 $ STATE_CODE                    : int  6 6 6 6 6 6 6 6 6 6 ...
 $ STATE                         : chr  "California" "California" "California" "California" ...
 $ COUNTY_CODE                   : int  1 1 1 1 1 1 1 1 1 1 ...
 $ COUNTY                        : chr  "Alameda" "Alameda" "Alameda" "Alameda" ...
 $ SITE_LATITUDE                 : num  37.7 37.7 37.7 37.7 37.7 ...
 $ SITE_LONGITUDE                : num  -122 -122 -122 -122 -122 ...
summary(PM2002$Site.ID)
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
60010007 60290014 60590007 60549600 60731002 61131003 
summary(PM2022$Site.ID)
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
60010007 60311004 60631007 60571692 60771003 61131003 
summary(PM2002$DAILY_AQI_VALUE)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.00   29.00   50.00   53.68   69.00  176.00 
summary(PM2022$DAILY_AQI_VALUE)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.00   18.00   29.00   32.95   45.00  353.00 
summary(PM2002$Daily.Mean.PM2.5.Concentration)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.00    7.00   12.00   16.12   20.50  104.30 
summary(PM2022$Daily.Mean.PM2.5.Concentration)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 -2.200   4.200   7.000   8.574  10.900 302.500 

2) Combine the two years of data into one data frame. Use the Date variable to create a new column for year, which will serve as an identifier. Change the names of the key variables so that they are easier to refer to in your code.

MAIN <- rbind(PM2002,PM2022)
library(lubridate)

Attaching package: 'lubridate'
The following objects are masked from 'package:base':

    date, intersect, setdiff, union
MAIN$Date <- mdy(MAIN$Date)
MAIN$Year <- year(MAIN$Date)
table(MAIN$Year)

 2002  2022 
15976 57775 
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
MAIN <- MAIN %>%
  rename(
    lat = SITE_LATITUDE,
    lon = SITE_LONGITUDE,
    meanPM = Daily.Mean.PM2.5.Concentration,
    AQI = DAILY_AQI_VALUE,
  
  )

3.Create a basic map in leaflet() that shows the locations of the sites (make sure to use different colors for each year). Summarize the spatial distribution of the monitoring sites.

The sites appear to be evenly distributed throughout the state. However, we can see that there is some sparseness towards Nevada and Arizona.

library(leaflet)
library(magrittr)
# color palette
Year.Pal <- colorBin(c('pink','purple'), domain=c(2002,2022))
#Make a map
PM.Map <- leaflet(MAIN) %>% 
  addProviderTiles('CartoDB.Positron')   %>%
  addCircles(
    lat = ~lat, lng=~lon,
    label = MAIN$Site.Name, color = ~ Year.Pal(c(2002,2022)),
    opacity = 1, fillOpacity = 1, radius = 500)  %>%
  addLegend('bottomleft', pal=Year.Pal, values = c(2002,2022),
          title='Year', opacity=1)
PM.Map
  1. Check for any missing or implausible values of PM2.5 in the combined dataset. Explore the proportions of each and provide a summary of any temporal patterns you see in these observations.

    In the combined dataset, we noticed that the PM 2.5 variable had a minimum value of -2.2, which is considered implausible as PM 2.5 levels cannot be negative. These negative values accounted for only 0.028% of the combined data. Although the year 2022 had a higher maximum PM 2.5 level, it also had a lower median daily average PM 2.5 compared to the year 2002. Additionally, there were instances of extremely high PM 2.5 levels exceeding 300 (Siskiyou County).

    summary(MAIN$meanPM)
       Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      -2.20    4.50    7.70   10.21   12.40  302.50 
length(subset(MAIN, meanPM<0))/nrow(MAIN)*100
[1] 0.02847419
library(dplyr)
library(furniture)

MAIN %>% 
  group_by(Year) %>% 
  furniture::table1("meanPM"= meanPM)
Using dplyr::group_by() groups: Year

──────────────────────────────
              Year 
        2002        2022     
        n = 15976   n = 57775
 meanPM                      
        16.1 (13.9) 8.6 (7.9)
──────────────────────────────
MAIN[which.max(MAIN$meanPM),]
            Date Source  Site.ID POC meanPM    UNITS AQI Site.Name
66524 2022-07-31    AQS 60932001   3  302.5 ug/m3 LC 353     Yreka
      DAILY_OBS_COUNT PERCENT_COMPLETE AQS_PARAMETER_CODE
66524               1              100              88101
            AQS_PARAMETER_DESC CBSA_CODE CBSA_NAME STATE_CODE      STATE
66524 PM2.5 - Local Conditions        NA                    6 California
      COUNTY_CODE   COUNTY      lat       lon Year
66524          93 Siskiyou 41.72689 -122.6336 2022
  1. Explore the main question of interest at three different spatial levels. Create exploratory plots (e.g. boxplots, histograms, line plots) and summary statistics that best suit each level of data. Be sure to write up explanations of what you observe in these data.

    In CA, we can see that PM2.5 concentrations were higher in 2022 than in 2002. At the county level, we can see that mean PM2.5 levels were higher in 2002 compared to 2022. At the city level, we can see that the PM2.5 concentration did not exceed 60.

    # Cali
    boxplot(MAIN$meanPM ~ MAIN$Year)

{tapply(MAIN$meanPM, MAIN$Year, summary)}

#County
table(MAIN$COUNTY_CODE, MAIN$COUNTY)
     
      Alameda Butte Calaveras Colusa Contra Costa Del Norte El Dorado Fresno
  1      1994     0         0      0            0         0         0      0
  7         0  1599         0      0            0         0         0      0
  9         0     0       415      0            0         0         0      0
  11        0     0         0    496            0         0         0      0
  13        0     0         0      0         1097         0         0      0
  15        0     0         0      0            0       568         0      0
  17        0     0         0      0            0         0       436      0
  19        0     0         0      0            0         0         0   3539
  21        0     0         0      0            0         0         0      0
  23        0     0         0      0            0         0         0      0
  25        0     0         0      0            0         0         0      0
  27        0     0         0      0            0         0         0      0
  29        0     0         0      0            0         0         0      0
  31        0     0         0      0            0         0         0      0
  33        0     0         0      0            0         0         0      0
  37        0     0         0      0            0         0         0      0
  39        0     0         0      0            0         0         0      0
  41        0     0         0      0            0         0         0      0
  43        0     0         0      0            0         0         0      0
  45        0     0         0      0            0         0         0      0
  47        0     0         0      0            0         0         0      0
  49        0     0         0      0            0         0         0      0
  51        0     0         0      0            0         0         0      0
  53        0     0         0      0            0         0         0      0
  57        0     0         0      0            0         0         0      0
  59        0     0         0      0            0         0         0      0
  61        0     0         0      0            0         0         0      0
  63        0     0         0      0            0         0         0      0
  65        0     0         0      0            0         0         0      0
  67        0     0         0      0            0         0         0      0
  69        0     0         0      0            0         0         0      0
  71        0     0         0      0            0         0         0      0
  73        0     0         0      0            0         0         0      0
  75        0     0         0      0            0         0         0      0
  77        0     0         0      0            0         0         0      0
  79        0     0         0      0            0         0         0      0
  81        0     0         0      0            0         0         0      0
  83        0     0         0      0            0         0         0      0
  85        0     0         0      0            0         0         0      0
  87        0     0         0      0            0         0         0      0
  89        0     0         0      0            0         0         0      0
  93        0     0         0      0            0         0         0      0
  95        0     0         0      0            0         0         0      0
  97        0     0         0      0            0         0         0      0
  99        0     0         0      0            0         0         0      0
  101       0     0         0      0            0         0         0      0
  103       0     0         0      0            0         0         0      0
  105       0     0         0      0            0         0         0      0
  107       0     0         0      0            0         0         0      0
  111       0     0         0      0            0         0         0      0
  113       0     0         0      0            0         0         0      0
     
      Glenn Humboldt Imperial Inyo Kern Kings Lake Los Angeles Madera Marin
  1       0        0        0    0    0     0    0           0      0     0
  7       0        0        0    0    0     0    0           0      0     0
  9       0        0        0    0    0     0    0           0      0     0
  11      0        0        0    0    0     0    0           0      0     0
  13      0        0        0    0    0     0    0           0      0     0
  15      0        0        0    0    0     0    0           0      0     0
  17      0        0        0    0    0     0    0           0      0     0
  19      0        0        0    0    0     0    0           0      0     0
  21    351        0        0    0    0     0    0           0      0     0
  23      0      175        0    0    0     0    0           0      0     0
  25      0        0     1752    0    0     0    0           0      0     0
  27      0        0        0 2157    0     0    0           0      0     0
  29      0        0        0    0 4135     0    0           0      0     0
  31      0        0        0    0    0   804    0           0      0     0
  33      0        0        0    0    0     0  122           0      0     0
  37      0        0        0    0    0     0    0        7013      0     0
  39      0        0        0    0    0     0    0           0    360     0
  41      0        0        0    0    0     0    0           0      0   573
  43      0        0        0    0    0     0    0           0      0     0
  45      0        0        0    0    0     0    0           0      0     0
  47      0        0        0    0    0     0    0           0      0     0
  49      0        0        0    0    0     0    0           0      0     0
  51      0        0        0    0    0     0    0           0      0     0
  53      0        0        0    0    0     0    0           0      0     0
  57      0        0        0    0    0     0    0           0      0     0
  59      0        0        0    0    0     0    0           0      0     0
  61      0        0        0    0    0     0    0           0      0     0
  63      0        0        0    0    0     0    0           0      0     0
  65      0        0        0    0    0     0    0           0      0     0
  67      0        0        0    0    0     0    0           0      0     0
  69      0        0        0    0    0     0    0           0      0     0
  71      0        0        0    0    0     0    0           0      0     0
  73      0        0        0    0    0     0    0           0      0     0
  75      0        0        0    0    0     0    0           0      0     0
  77      0        0        0    0    0     0    0           0      0     0
  79      0        0        0    0    0     0    0           0      0     0
  81      0        0        0    0    0     0    0           0      0     0
  83      0        0        0    0    0     0    0           0      0     0
  85      0        0        0    0    0     0    0           0      0     0
  87      0        0        0    0    0     0    0           0      0     0
  89      0        0        0    0    0     0    0           0      0     0
  93      0        0        0    0    0     0    0           0      0     0
  95      0        0        0    0    0     0    0           0      0     0
  97      0        0        0    0    0     0    0           0      0     0
  99      0        0        0    0    0     0    0           0      0     0
  101     0        0        0    0    0     0    0           0      0     0
  103     0        0        0    0    0     0    0           0      0     0
  105     0        0        0    0    0     0    0           0      0     0
  107     0        0        0    0    0     0    0           0      0     0
  111     0        0        0    0    0     0    0           0      0     0
  113     0        0        0    0    0     0    0           0      0     0
     
      Mariposa Mendocino Merced Modoc Mono Monterey Nevada Orange Placer Plumas
  1          0         0      0     0    0        0      0      0      0      0
  7          0         0      0     0    0        0      0      0      0      0
  9          0         0      0     0    0        0      0      0      0      0
  11         0         0      0     0    0        0      0      0      0      0
  13         0         0      0     0    0        0      0      0      0      0
  15         0         0      0     0    0        0      0      0      0      0
  17         0         0      0     0    0        0      0      0      0      0
  19         0         0      0     0    0        0      0      0      0      0
  21         0         0      0     0    0        0      0      0      0      0
  23         0         0      0     0    0        0      0      0      0      0
  25         0         0      0     0    0        0      0      0      0      0
  27         0         0      0     0    0        0      0      0      0      0
  29         0         0      0     0    0        0      0      0      0      0
  31         0         0      0     0    0        0      0      0      0      0
  33         0         0      0     0    0        0      0      0      0      0
  37         0         0      0     0    0        0      0      0      0      0
  39         0         0      0     0    0        0      0      0      0      0
  41         0         0      0     0    0        0      0      0      0      0
  43       870         0      0     0    0        0      0      0      0      0
  45         0       823      0     0    0        0      0      0      0      0
  47         0         0    808     0    0        0      0      0      0      0
  49         0         0      0     2    0        0      0      0      0      0
  51         0         0      0     0  806        0      0      0      0      0
  53         0         0      0     0    0     1243      0      0      0      0
  57         0         0      0     0    0        0   1236      0      0      0
  59         0         0      0     0    0        0      0   1352      0      0
  61         0         0      0     0    0        0      0      0   1848      0
  63         0         0      0     0    0        0      0      0      0   1453
  65         0         0      0     0    0        0      0      0      0      0
  67         0         0      0     0    0        0      0      0      0      0
  69         0         0      0     0    0        0      0      0      0      0
  71         0         0      0     0    0        0      0      0      0      0
  73         0         0      0     0    0        0      0      0      0      0
  75         0         0      0     0    0        0      0      0      0      0
  77         0         0      0     0    0        0      0      0      0      0
  79         0         0      0     0    0        0      0      0      0      0
  81         0         0      0     0    0        0      0      0      0      0
  83         0         0      0     0    0        0      0      0      0      0
  85         0         0      0     0    0        0      0      0      0      0
  87         0         0      0     0    0        0      0      0      0      0
  89         0         0      0     0    0        0      0      0      0      0
  93         0         0      0     0    0        0      0      0      0      0
  95         0         0      0     0    0        0      0      0      0      0
  97         0         0      0     0    0        0      0      0      0      0
  99         0         0      0     0    0        0      0      0      0      0
  101        0         0      0     0    0        0      0      0      0      0
  103        0         0      0     0    0        0      0      0      0      0
  105        0         0      0     0    0        0      0      0      0      0
  107        0         0      0     0    0        0      0      0      0      0
  111        0         0      0     0    0        0      0      0      0      0
  113        0         0      0     0    0        0      0      0      0      0
     
      Riverside Sacramento San Benito San Bernardino San Diego San Francisco
  1           0          0          0              0         0             0
  7           0          0          0              0         0             0
  9           0          0          0              0         0             0
  11          0          0          0              0         0             0
  13          0          0          0              0         0             0
  15          0          0          0              0         0             0
  17          0          0          0              0         0             0
  19          0          0          0              0         0             0
  21          0          0          0              0         0             0
  23          0          0          0              0         0             0
  25          0          0          0              0         0             0
  27          0          0          0              0         0             0
  29          0          0          0              0         0             0
  31          0          0          0              0         0             0
  33          0          0          0              0         0             0
  37          0          0          0              0         0             0
  39          0          0          0              0         0             0
  41          0          0          0              0         0             0
  43          0          0          0              0         0             0
  45          0          0          0              0         0             0
  47          0          0          0              0         0             0
  49          0          0          0              0         0             0
  51          0          0          0              0         0             0
  53          0          0          0              0         0             0
  57          0          0          0              0         0             0
  59          0          0          0              0         0             0
  61          0          0          0              0         0             0
  63          0          0          0              0         0             0
  65       5216          0          0              0         0             0
  67          0       3378          0              0         0             0
  69          0          0        597              0         0             0
  71          0          0          0           3733         0             0
  73          0          0          0              0      4497             0
  75          0          0          0              0         0           557
  77          0          0          0              0         0             0
  79          0          0          0              0         0             0
  81          0          0          0              0         0             0
  83          0          0          0              0         0             0
  85          0          0          0              0         0             0
  87          0          0          0              0         0             0
  89          0          0          0              0         0             0
  93          0          0          0              0         0             0
  95          0          0          0              0         0             0
  97          0          0          0              0         0             0
  99          0          0          0              0         0             0
  101         0          0          0              0         0             0
  103         0          0          0              0         0             0
  105         0          0          0              0         0             0
  107         0          0          0              0         0             0
  111         0          0          0              0         0             0
  113         0          0          0              0         0             0
     
      San Joaquin San Luis Obispo San Mateo Santa Barbara Santa Clara
  1             0               0         0             0           0
  7             0               0         0             0           0
  9             0               0         0             0           0
  11            0               0         0             0           0
  13            0               0         0             0           0
  15            0               0         0             0           0
  17            0               0         0             0           0
  19            0               0         0             0           0
  21            0               0         0             0           0
  23            0               0         0             0           0
  25            0               0         0             0           0
  27            0               0         0             0           0
  29            0               0         0             0           0
  31            0               0         0             0           0
  33            0               0         0             0           0
  37            0               0         0             0           0
  39            0               0         0             0           0
  41            0               0         0             0           0
  43            0               0         0             0           0
  45            0               0         0             0           0
  47            0               0         0             0           0
  49            0               0         0             0           0
  51            0               0         0             0           0
  53            0               0         0             0           0
  57            0               0         0             0           0
  59            0               0         0             0           0
  61            0               0         0             0           0
  63            0               0         0             0           0
  65            0               0         0             0           0
  67            0               0         0             0           0
  69            0               0         0             0           0
  71            0               0         0             0           0
  73            0               0         0             0           0
  75            0               0         0             0           0
  77         1173               0         0             0           0
  79            0            1606         0             0           0
  81            0               0       456             0           0
  83            0               0         0          1679           0
  85            0               0         0             0        1651
  87            0               0         0             0           0
  89            0               0         0             0           0
  93            0               0         0             0           0
  95            0               0         0             0           0
  97            0               0         0             0           0
  99            0               0         0             0           0
  101           0               0         0             0           0
  103           0               0         0             0           0
  105           0               0         0             0           0
  107           0               0         0             0           0
  111           0               0         0             0           0
  113           0               0         0             0           0
     
      Santa Cruz Shasta Siskiyou Solano Sonoma Stanislaus Sutter Tehama Trinity
  1            0      0        0      0      0          0      0      0       0
  7            0      0        0      0      0          0      0      0       0
  9            0      0        0      0      0          0      0      0       0
  11           0      0        0      0      0          0      0      0       0
  13           0      0        0      0      0          0      0      0       0
  15           0      0        0      0      0          0      0      0       0
  17           0      0        0      0      0          0      0      0       0
  19           0      0        0      0      0          0      0      0       0
  21           0      0        0      0      0          0      0      0       0
  23           0      0        0      0      0          0      0      0       0
  25           0      0        0      0      0          0      0      0       0
  27           0      0        0      0      0          0      0      0       0
  29           0      0        0      0      0          0      0      0       0
  31           0      0        0      0      0          0      0      0       0
  33           0      0        0      0      0          0      0      0       0
  37           0      0        0      0      0          0      0      0       0
  39           0      0        0      0      0          0      0      0       0
  41           0      0        0      0      0          0      0      0       0
  43           0      0        0      0      0          0      0      0       0
  45           0      0        0      0      0          0      0      0       0
  47           0      0        0      0      0          0      0      0       0
  49           0      0        0      0      0          0      0      0       0
  51           0      0        0      0      0          0      0      0       0
  53           0      0        0      0      0          0      0      0       0
  57           0      0        0      0      0          0      0      0       0
  59           0      0        0      0      0          0      0      0       0
  61           0      0        0      0      0          0      0      0       0
  63           0      0        0      0      0          0      0      0       0
  65           0      0        0      0      0          0      0      0       0
  67           0      0        0      0      0          0      0      0       0
  69           0      0        0      0      0          0      0      0       0
  71           0      0        0      0      0          0      0      0       0
  73           0      0        0      0      0          0      0      0       0
  75           0      0        0      0      0          0      0      0       0
  77           0      0        0      0      0          0      0      0       0
  79           0      0        0      0      0          0      0      0       0
  81           0      0        0      0      0          0      0      0       0
  83           0      0        0      0      0          0      0      0       0
  85           0      0        0      0      0          0      0      0       0
  87         771      0        0      0      0          0      0      0       0
  89           0    755        0      0      0          0      0      0       0
  93           0      0      805      0      0          0      0      0       0
  95           0      0        0    817      0          0      0      0       0
  97           0      0        0      0    442          0      0      0       0
  99           0      0        0      0      0        955      0      0       0
  101          0      0        0      0      0          0    829      0       0
  103          0      0        0      0      0          0      0    347       0
  105          0      0        0      0      0          0      0      0     492
  107          0      0        0      0      0          0      0      0       0
  111          0      0        0      0      0          0      0      0       0
  113          0      0        0      0      0          0      0      0       0
     
      Tulare Ventura Yolo
  1        0       0    0
  7        0       0    0
  9        0       0    0
  11       0       0    0
  13       0       0    0
  15       0       0    0
  17       0       0    0
  19       0       0    0
  21       0       0    0
  23       0       0    0
  25       0       0    0
  27       0       0    0
  29       0       0    0
  31       0       0    0
  33       0       0    0
  37       0       0    0
  39       0       0    0
  41       0       0    0
  43       0       0    0
  45       0       0    0
  47       0       0    0
  49       0       0    0
  51       0       0    0
  53       0       0    0
  57       0       0    0
  59       0       0    0
  61       0       0    0
  63       0       0    0
  65       0       0    0
  67       0       0    0
  69       0       0    0
  71       0       0    0
  73       0       0    0
  75       0       0    0
  77       0       0    0
  79       0       0    0
  81       0       0    0
  83       0       0    0
  85       0       0    0
  87       0       0    0
  89       0       0    0
  93       0       0    0
  95       0       0    0
  97       0       0    0
  99       0       0    0
  101      0       0    0
  103      0       0    0
  105      0       0    0
  107   1731       0    0
  111      0    2710    0
  113      0       0  527
PM.LAC <- subset(MAIN, COUNTY_CODE == "37")
boxplot(PM.LAC$meanPM ~ PM.LAC$Year)

tapply(PM.LAC$meanPM, PM.LAC$Year, summary)
$`2002`
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   0.60   11.10   17.40   19.66   25.50   72.40 

$`2022`
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  -1.20    7.40   10.40   11.04   13.80   56.00 
#Site in LA
table(PM.LAC$Site.ID, PM.LAC$Site.Name) #Burbank 60371002
          
                Azusa Burbank Compton Glendora Lancaster-Division Street Lebec
  60370002    0   415       0       0        0                         0     0
  60370016    0     0       0       0      365                         0     0
  60371002    0     0     122       0        0                         0     0
  60371103    0     0       0       0        0                         0     0
  60371201    0     0       0       0        0                         0     0
  60371301    0     0       0       0        0                         0     0
  60371302    0     0       0     723        0                         0     0
  60371601  118     0       0       0        0                         0     0
  60371602    0     0       0       0        0                         0     0
  60372005    0     0       0       0        0                         0     0
  60374002    0     0       0       0        0                         0     0
  60374004    0     0       0       0        0                         0     0
  60374008    0     0       0       0        0                         0     0
  60374009    0     0       0       0        0                         0     0
  60374010    0     0       0       0        0                         0     0
  60376012    0     0       0       0        0                         0     0
  60379033    0     0       0       0        0                       459     0
  60379034    0     0       0       0        0                         0   150
          
           Long Beach (North) Long Beach (South) Long Beach-Route 710 Near Road
  60370002                  0                  0                              0
  60370016                  0                  0                              0
  60371002                  0                  0                              0
  60371103                  0                  0                              0
  60371201                  0                  0                              0
  60371301                  0                  0                              0
  60371302                  0                  0                              0
  60371601                  0                  0                              0
  60371602                  0                  0                              0
  60372005                  0                  0                              0
  60374002                411                  0                              0
  60374004                  0                243                              0
  60374008                  0                  0                            625
  60374009                  0                  0                              0
  60374010                  0                  0                              0
  60376012                  0                  0                              0
  60379033                  0                  0                              0
  60379034                  0                  0                              0
          
           Los Angeles-North Main Street Lynwood North Hollywood (NOHO)
  60370002                             0       0                      0
  60370016                             0       0                      0
  60371002                             0       0                      0
  60371103                          1276       0                      0
  60371201                             0       0                      0
  60371301                             0     122                      0
  60371302                             0       0                      0
  60371601                             0       0                      0
  60371602                             0       0                      0
  60372005                             0       0                      0
  60374002                             0       0                      0
  60374004                             0       0                      0
  60374008                             0       0                      0
  60374009                             0       0                      0
  60374010                             0       0                    365
  60376012                             0       0                      0
  60379033                             0       0                      0
  60379034                             0       0                      0
          
           Pasadena Pico Rivera #2 Reseda Santa Clarita Signal Hill (LBSH)
  60370002        0              0      0             0                  0
  60370016        0              0      0             0                  0
  60371002        0              0      0             0                  0
  60371103        0              0      0             0                  0
  60371201        0              0    602             0                  0
  60371301        0              0      0             0                  0
  60371302        0              0      0             0                  0
  60371601        0              0      0             0                  0
  60371602        0            118      0             0                  0
  60372005      241              0      0             0                  0
  60374002        0              0      0             0                  0
  60374004        0              0      0             0                  0
  60374008        0              0      0             0                  0
  60374009        0              0      0             0                293
  60374010        0              0      0             0                  0
  60376012        0              0      0           365                  0
  60379033        0              0      0             0                  0
  60379034        0              0      0             0                  0
PM.bur <- subset(MAIN, Site.ID == "60371002")
boxplot(PM.bur$meanPM ~ PM.bur$Year)

tapply(PM.bur$meanPM, PM.bur$Year, summary)
$`2002`
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   3.50   14.90   21.65   23.97   28.85   63.00